#include "Utils.hpp"

#include <cmath>

const double Utils::PI = 3.14159265;

int Utils::normaliseAngle(int angle)
{
    while ( angle >= 360 )
    {
        angle -= 360;
    }

    while ( angle < 0)
    {
        angle += 360;
    }
    return angle;
}

unsigned int Utils::distance(const float x1, const float y1,
                              const float x2, const float y2)
{
    float distX = x1 - x2;
    float distY = y1 - y2;

    return sqrtf(distX * distX + distY * distY);
}
